import * as  types from '../action-types';

let initalState = {username: null};

export default function (state = initalState, action) {
    switch (action.type) {
        case types.LOGIN_SUCCESS:
            return {
                token: action.payload
            }
        case types.LOGIN_ERROR:
            return {
                error: action.e
            };
        case types.LOGOUT_SUCCESS:
            return {};

        default :
            return state
    }
}
